Skip to content

bugc: list variables before a function's first statement - #358

Closed
gnidan wants to merge 1 commit into
mainfrom
bugc-gap-variables
Closed

gnidan wants to merge 1 commit into
mainfrom
bugc-gap-variables

Conversation

@gnidan

@gnidan gnidan commented Oct 7, 2026

Copy link
Copy Markdown
Member

Two runs of code that bugc emits outside any IR instruction had no variables context, so a debugger listed no variables at all on the steps after them:

  • the memory setup at the start of the code (and create) block, which sets the free memory pointer and the frame pointer: only a code range, so the storage variables were missing for the first few steps
  • a function's entry JUMPDEST and its prologue, which allocates the frame and stores the arguments in it: an invoke and a code range. The parameters are live here, but they were not listed until the body's first instruction

Both now list the variables of the entry block, as the variables pass gives them just before its first instruction (or that instruction's own, when the function has no locals). A local is listed without a pointer. During the prologue the frame pointer still names the caller's frame until the prologue has set it up, so a frame-relative pointer would read the caller's words. The invoke's arguments already point at the parameters on the stack.

The empty block on a branch edge into a block with phis also listed no variables. #356 fixes that, because the block's missing inline transform had the same cause.

@gnidan
gnidan force-pushed the bugc-gap-variables branch from cfaa527 to 63304a4 Compare October 7, 2026 01:40
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-07 03:10 UTC

@gnidan

gnidan commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

Included in #368.

@gnidan gnidan closed this Oct 7, 2026
@gnidan
gnidan deleted the bugc-gap-variables branch October 7, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant